package cn.com.zpark.listener;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @PackageName: cn.com.zpark.listener
 * @ClassName: Servlet01
 * @Description:
 * @author: RZS
 * @date: 2021/11/23  16:46
 */
@WebServlet("/s1.do")
public class Servlet01 extends HttpServlet {
    /**
     * 统计用户访问网站的次数
     */

    private int num = 0;

    @Override
    protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        response.setContentType("text/html;charset=utf-8");
        response.getWriter().write("<h1>您一个访问了本网站"+(++num)+"次</h1>");
    }
}

